home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: May 2000
- //
- // Procedure Name:
- // artAttrInitPaintableAttr
- //
- // Description:
- // Initializes the paintable attribute.
- //
- // Return Value:
- // 0 - if the selection failed.
- // 1 - if the selection succeded.
- //
- global string $gArtAttrFilterLabel = "Filter: all";
- global string $gArtAttrCurrentAttr = ""; // Currently selected paintable attr.
-
- proc int artAttrValidateAttr(
- string $attribute
- )
- // Validate that the attribute is paintable.
- {
- string $buf[];
- tokenize($attribute, ".", $buf);
- if (size($buf) < 3)
- return 0;
-
- $attr = $buf[0] + "." + $buf[1] + "." + $buf[2];
- string $isPaintableCmd = "makePaintable -q " + $buf[0] + " " + $buf[2];
- int $isPaintable[] = eval($isPaintableCmd);
-
- return size($isPaintable);
- }
-
-
- proc int artAttrFindFirstPaintableAttr()
- {
- string $artCmd = "artAttrCtx";
-
- string $attr = "";
- string $cmd = $artCmd + " -q -objattrArray " + `currentCtx`;
- string $paintAttr = `eval $cmd`;
- string $ListPaintableItem[];
- tokenize( $paintAttr, " ", $ListPaintableItem );
- if (size($ListPaintableItem) < 1) {
- return 0;
- }
-
- for ($paintableItem in $ListPaintableItem) {
- string $buf[];
- tokenize($paintableItem, ".", $buf);
- if (size($buf) < 3) {
- continue;
- }
-
- $attr = $buf[0] + "." + $buf[1] + "." + $buf[2];
-
- //skip vertexColorRGB and vertexFaceColorRGB attrs as they cannot be painted
- // with Attribute paint tool till we support color painting.
- if( $buf[2] == "vertexColorRGB" || $buf[2] == "vertexFaceColorRGB") {
- continue ;
- }
-
- string $isPaintableCmd = "makePaintable -q " + $buf[0] + " " + $buf[2];
-
- int $isPaintable[] = eval($isPaintableCmd);
- if (size($isPaintable) < 1) {
- continue;
- }
-
- if ($isPaintable[0]) {
- artAttrSelected( $artCmd, $attr );
- return 1;
- }
- }
-
- return 0 ;
-
- }
-
- global proc int artAttrSetPaintableNode()
- {
- source "artAttrCallback.mel";
-
- string $artCmd = "artAttrCtx";
-
- global string $gArtAttrCurrentAttr;
-
- if ( $gArtAttrCurrentAttr != "" ) {
-
- // Verify that this attribute is still a valid selection.
- if ( artAttrValidateAttr( $gArtAttrCurrentAttr ) ) {
- artAttrSelected( $artCmd, $gArtAttrCurrentAttr );
- return 1;
- }
-
- $gArtAttrCurrentAttr = "";
- }
-
- return artAttrFindFirstPaintableAttr();
- }
-
- global proc int artAttrInitPaintableAttr()
- {
- source "artAttrCallback.mel";
-
- global string $gArtAttrCurrentAttr;
-
- $gArtAttrCurrentAttr = "";
-
- return artAttrFindFirstPaintableAttr() ;
- }
-